<?php

include 'class/main_class.php';
echo "<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>";
echo "<link href='theme/style.css' rel='stylesheet' type='text/css' />";

$main = new main_class;

echo	"<div id='login-page'>
			<div id='login-content'>
				<div id='login-content-txt'>
				<center>
				<p>
				<a href='index.php'>
				<img src='theme/img/logo.jpg' border='0'>
				</a>
				</p>
				<hr>
				<p>";

				if(isset($_POST['userlogin']))
				{	
					$username = $_POST['username'];
					$password = sha1($_POST['password']);
					if(empty($username) || empty($password))
					{
						echo	"<font color='red'>U heeft geen gebruikersnaam of wachtwoord ingevuld</font>";
					}
					else
					{
						$main->klant_login($username, $password);
					}
				}
				
				if(isset($_GET['logout']))
				{
					unset($_SESSION['userlogin']);
					echo "<p>U bent nu uitgelogd.</p>";
				}
				
				if(empty($_SESSION['userlogin']))
				{
					echo	"<form method='POST' action='".$_SERVER['PHP_SELF']."'>
							<table>
							<tr>
							<td>Gebruiksnaam:</td><td><input type='text' name='username' size='24'></td>
							</tr>
							<tr>
							<td>Wachtwoord:</td><td><input type='password' name='password' size='24'></td>
							</tr>
							<tr>
							<td><p><a href='register.php'><input type='button' value='Registreren'></a>&nbsp;&nbsp;&nbsp;&nbsp;</td>
							<td><center><input type='submit' name='userlogin' value='Login'></center></td>
							</tr>
							</table>
							</form>
							<font style='font-size:11px;'><a href='lostpw.php'>Gebruikersnaam of Wachtwoord vergeten?</a></font></p><br>";
				}
				
echo	"		</p>
				<hr>
				<p><a href='index.php'>Terug naar de Webwinkel</a></p>
				</center>
				</div>
			</div>
		</div>";

?>